home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 02 Useful Techniques / 08 Zarozinski / src / ffllapi / MemberFuncSingle.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-16  |  2.1 KB  |  68 lines

  1. //
  2. // File:    MemberFuncSingle.h
  3. //
  4. // Purpose:    This class is for the Singleton member function
  5. //
  6. // Copyright ⌐ 1999-2001 Louder Than A Bomb! Software
  7. //
  8. // This file is part of the FFLL (Free Fuzzy Logic Library) project (http://ffll.sourceforge.net)
  9. // It is released under the BSD license, see http://ffll.sourceforge.net/license.txt for the full text.
  10. //
  11.  
  12. #if !defined(AFX_MemberFuncSingle_H__DE3C07E3_650E_11D3_B77F_906F59C10001__INCLUDED_)
  13. #define AFX_MemberFuncSingle_H__DE3C07E3_650E_11D3_B77F_906F59C10001__INCLUDED_
  14.  
  15. #include "MemberFuncBase.h"
  16.  
  17. // 
  18. // Class:    MemberFuncSingle
  19. //
  20. // This is the singleton shaped membership function. It consists of 1 point.
  21. // Singletons are used to represent discreet choices. For example if one of the
  22. // inputs to a fuzzy system was "type of car" we may use singeltons with values
  23. // such as "Ford", "GM", "VW", etc. They are discreet choices there's no fuzzyness
  24. // involved.
  25. // 
  26.  
  27. class FFLL_API   MemberFuncSingle : virtual public MemberFuncBase  
  28. {
  29.      ////////////////////////////////////////
  30.     ////////// Member Functions ////////////
  31.     ////////////////////////////////////////
  32.  
  33.     public:
  34.  
  35.         // constructor/destructor funcs
  36.         MemberFuncSingle(); // No function body for this. Explicitly disallow auto-creation of it by the compiler
  37.         MemberFuncSingle(FuzzySetBase* _parent) ;
  38.          virtual ~MemberFuncSingle();
  39.  
  40.         // get functions
  41.         virtual int get_center_x(void) const ;
  42.          int get_func_type() const ;
  43.           int get_node_count() const ;
  44.  
  45.         // set functions
  46.         void set_node(int idx, int x, int y, bool validate = true);
  47.           void set_ramp(int hi_lo_ind, int left_right_ind);
  48.  
  49.         // misc functions
  50.         void calc( );
  51.           virtual void save_to_fcl_file(std::ofstream& file_contents);
  52.         virtual void expand(int x_delta );
  53.          virtual void shrink(int x_delta );
  54.  
  55.     protected:
  56.  
  57.         // misc functions
  58.          void init_nodes(int start_x, int term_width);
  59.  
  60.  
  61. }; // end class MemberFuncSingle
  62.  
  63. #else
  64.  
  65. class MemberFuncSingle; // already defined
  66.  
  67. #endif // !defined(AFX_MemberFuncSingle_H__DE3C07E3_650E_11D3_B77F_906F59C10001__INCLUDED_)
  68.